package com.mobilebsc.app;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.EditText;
import android.widget.Spinner;
import android.widget.TextView;

import com.example.mobilebsc.R;
import com.mobilebsc.datamanager.IDataReadyListener;
import com.mobilebsc.datamanager.WeakSignalsDataManager;
import com.mobilebsc.datatype.WeakSignal;

public class AddWSActivity extends Activity implements IDataReadyListener
{
    private WeakSignalsDataManager wsdm = new WeakSignalsDataManager(this);
    
	@Override
	protected void onCreate(Bundle savedInstanceState) 
	{	
		super.onCreate(savedInstanceState);
		
		setContentView(R.layout.activity_addweaksignals);

        TextView tvBC = (TextView) findViewById(R.id.textViewBC);
        tvBC.setText("Home > Add Weak Signal >");
        
        Spinner spinner = (Spinner) findViewById(R.id.Spinner1);
        ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(
                this, R.array.strArr_DemoDaten, R.layout.spinner_layout);
        spinner.setAdapter(adapter);
	}

	public void onClick_btn_GoAddWS(View view) 
	{
	    String wsName = ((EditText) findViewById(R.id.txtWSName)).getText().toString();
	    String wsDescription = ((EditText) findViewById(R.id.txtWSDescription)).getText().toString();
	    String wsSource = ((EditText) findViewById(R.id.txtWSSource)).getText().toString();
        
	    Log.i("Test", wsName);
	    Log.i("Test", wsDescription);
	    Log.i("Test", wsSource);
	    
	    WeakSignal ws = new WeakSignal(wsName, wsDescription, wsSource);
	    
	    wsdm.add(ws);
	    
		startActivity(new Intent(this, MainActivity.class));
	}
	
	public void onClick_btn_Back(View view)
    {
        startActivity(new Intent(this, MainActivity.class));
    }

    @Override
    public void dataReady()
    {
    }
}
